package org.mariotaku.aria2;

import java.util.HashMap;

public class Status extends CommonItem {

	public Status(HashMap<String, Object> data) {
		init(data);
	}

	/**
	 * Struct which contains information retrieved from .torrent file.
	 * BitTorrent only. It contains following keys.
	 */
	public class BitTorrent {

		/**
		 * Struct which contains data from Info dictionary. It contains
		 * following keys.
		 */
		public class Info {

			/**
			 * name in info dictionary. name.utf-8 is used if available.
			 */
			public String name = "";
		}

		/**
		 * List of lists of announce URI. If .torrent file contains announce and
		 * no announce-list, announce is converted to announce-list format.
		 */
		public String announceList = "";

		/**
		 * The comment for the torrent. comment.utf-8 is used if available.
		 */
		public String comment = "";

		/**
		 * The creation time of the torrent. The value is an integer since the
		 * Epoch, measured in seconds.
		 */
		public String creationDate = "";

		/**
		 * File mode of the torrent. The value is either single or multi.
		 */
		public String mode = "";
	}

	/**
	 * GID of this download.
	 */
	public int gid = -1;

	/**
	 * "active" for currently downloading/seeding entry. "waiting" for the entry
	 * in the queue; download is not started. "paused" for the paused entry.
	 * "error" for the stopped download because of error. "complete" for the
	 * stopped and completed download. "removed" for the download removed by
	 * user.
	 */
	public String status = "";

	/**
	 * 
	 Total length of this download in bytes.
	 */
	public String totalLength = "";

	/**
	 * 
	 Completed length of this download in bytes.
	 */
	public String completedLength = "";

	/**
	 * 
	 Uploaded length of this download in bytes.
	 */
	public String uploadLength = "";

	/**
	 * Hexadecimal representation of the download progress. The highest bit
	 * corresponds to piece index 0. The set bits indicate the piece is
	 * available and unset bits indicate the piece is missing. The spare bits at
	 * the end are set to zero. When download has not started yet, this key will
	 * not be included in the response.
	 */

	public String bitfield = "";

	/**
	 * 
	 Download speed of this download measured in bytes/sec.
	 */
	public String downloadSpeed = "";

	/**
	 * 
	 Upload speed of this download measured in bytes/sec.
	 */
	public String uploadSpeed = "";

	/**
	 * 
	 InfoHash. BitTorrent only.
	 */
	public String infoHash = "";

	/**
	 * 
	 The number of seeders the client has connected to. BitTorrent only.
	 */
	public String numSeeders = "";

	/**
	 * 
	 Piece length in bytes.
	 */
	public String pieceLength = "";

	/**
	 * 
	 The number of pieces.
	 */
	public String numPieces = "";

	/**
	 * 
	 The number of peers/servers the client has connected to.
	 */
	public String connections = "";

	/**
	 * The last error code occurred in this download. The value is of type
	 * string. The error codes are defined in EXIT STATUS section. This value is
	 * only available for stopped/completed downloads.
	 */
	public String errorCode = "";

	/**
	 * List of GIDs which are generated by the consequence of this download. For
	 * example, when aria2 downloaded Metalink file, it generates downloads
	 * described in it(see --follow-metalink option). This value is useful to
	 * track these auto generated downloads. If there is no such downloads, this
	 * key will not be included in the response.
	 */
	public String followedBy = "";

	/**
	 * GID of a parent download. Some downloads are a part of another download.
	 * For example, if a file in Metalink has BitTorrent resource, the download
	 * of .torrent is a part of that file. If this download has no parent, this
	 * key will not be included in the response.
	 */
	public String belongsTo = "";

	/**
	 * Directory to save files. This key is not available for stopped downloads.
	 */
	public String dir = "";

	/**
	 * Returns the list of files. The element of list is the same struct used in
	 * aria2.getFiles method.
	 */
	public String files = "";
}
